package com.budwk.app.sqfwV2.generator.wasteCategory.pdf;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.budwk.app.sqfw.constants.CommonConstants;
import com.budwk.app.sqfwDoc.codeGeneratorV2.fileParam.CommonParam;
import com.budwk.app.sqfwDoc.codeGeneratorV2.fileParam.PdfGenerateParam;
import com.budwk.app.sqfwDoc.codeGeneratorV2.generate.BasePdfGenerator;
import com.budwk.app.sqfwV2.component.ProblemComponent;
import com.budwk.app.sqfwV2.component.SignImageComponent;
import com.budwk.app.sqfwV2.dto.dto.WasteCategoryNewPdfDTO;

import java.util.Map;

/**
 * @author 垃圾分类
 */
public class RefuseClassifyYuHongDocGenerator extends BasePdfGenerator{

    @Override
    public boolean pdfCreateConditionCheck(PdfGenerateParam pdfGenerateParam) {
        CommonParam commonParam = pdfGenerateParam.getCreateUserCommonParam();
        // 云潭街道的
        String community = commonParam.getCommunity();
        return community.equals(CommonConstants.YUNTAN_STREET);
    }

    @Override
    public String getTemplatePath(PdfGenerateParam pdfGenerateParam) {
        return "sqfwV2/wasteCategory/refuseClassifyYuHongSQ.docx";
    }

    @Override
    public void customerPopularPdfParam(Map<String, Object> paramMap, PdfGenerateParam pdfGenerateParam) {
        // 在这里对一些数据进行填充 进行复杂的业务代码逻辑
        WasteCategoryNewPdfDTO pdfDTO = ProblemComponent.getPdfDTO(pdfGenerateParam.getAbstractCustomerPdfCreateField());
        CommonParam commonParam = pdfGenerateParam.getCreateUserCommonParam();
        // 签名
        SignImageComponent.signWord(paramMap, null, commonParam.getCreateUserSigUrl(), commonParam.getCreateUserName(), "checkedUnitLeader", "checkedUnitLeaderStr");
        SignImageComponent.signWordImages(paramMap, null, pdfDTO.getSitePhotos(), "imagess", "images", null, null);
        // 巡查时间
        paramMap.put("fillDate", LocalDateTimeUtil.format(pdfDTO.getFillDate(), DatePattern.CHINESE_DATE_PATTERN));
    }
}









